home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
lang_c
/
mrk2srch
/
mrk2srch.cb
Wrap
C/C++ Source or Header
|
1990-02-01
|
843b
|
36 lines
/*
* file: mrk2srch.cb
* copies marked pattern into extern string _s_pat
* which can be used for searches ( or search & replace )
*/
extern string _s_pat;
extern int _reg_exp;
string mrk2srch()
{
int col0,row0,col1,row1; // marked positions
if( inq_marked( row0, col0, row1, col1 ) )
{
save_position();
_s_pat = "";
move_abs( row0, col0 ); // goto start of marked section
while( row0 != row1 )
{
_s_pat += read(); // read to eol, append to _s_pat
move_abs( ++row0, 1 ); // goto beginning of next line
}
_s_pat += read( col1 - col0 +1 );// read marked part of line ending mark
restore_position();
_reg_exp = 1; // turn on regular expression search
message( "%s copied to _s_pat",_s_pat );
return( _s_pat );
}
else
error("Nothing is marked");
}